<?php

require_once($_SERVER["DOCUMENT_ROOT"]."/app/db/mysql/MySQLDatabase.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/app/logger.php");

/// Please, don't kick me ;)

class ProviderFactory
{

	public static function create($provider = "", $hostname = "", $dbname = "", $username = "", $passwd = "", $encoding = "")
	{
		if ( is_string($provider) && strlen($provider) != null )
		{
			switch( strtolower($provider) )
			{
				case "mysql" : return new MySQLDatabase($hostname, $dbname, $username, $passwd, $encoding);
				#case "sqlite" : return new SQLiteDatabase();
				default : return new MySQLDatabase($hostname, $dbname, $username, $passwd, $encoding);
			}
		}
		else
			Logger::getInstance()->error("Invalid provider value in ProviderFactory::create() !");		
	}

}

?>